package com.wondertek.mam.tag.web.rest.util;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * Created by wangdongxu on 2017-07-21 下午 14:41:06.
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class  RespBody {
    private String code;
    private String  message;
    private String description;
    private Object data;
    private Integer totalPages;
    private Integer totalElements;

    public Integer getTotalPages() {
        return totalPages;
    }

    public RespBody setTotalPages(Integer totalPages) {
        this.totalPages = totalPages;
        return this;
    }

    public Integer getTotalElements() {
        return totalElements;
    }

    public RespBody setTotalElements(Integer totalElements) {
        this.totalElements = totalElements;
        return this;
    }

    public String getCode() {
        return code;
    }

    public RespBody setCode(String code) {
        this.code = code;
        return this;
    }

    public String getMessage() {
        return message;
    }

    public RespBody setMessage(String masg) {
        this.message = masg;
        return this;
    }

    public String getDescription() {
        return description;
    }

    public RespBody setDescription(String description) {
        this.description = description;
        return this;
    }

    public Object getData() {
        return data;
    }

    public RespBody setData(Object data) {
        this.data = data;
        return this;
    }

    public static RespBody ok(Object data){
        RespBody respBody = new RespBody();
        respBody.setCode("20000");
        respBody.setMessage("success");
        respBody.setDescription("success");
        respBody.setData(data);
        return respBody;
    }
    public static RespBody ok(){
        RespBody respBody = new RespBody();
        respBody.setCode("20000");
        respBody.setMessage("success");
        respBody.setDescription("success");
        return respBody;
    }
    public static RespBody build(){
        RespBody respBody = new RespBody();
        return respBody;
    }
    public static RespBody build(Object data){
        RespBody respBody = new RespBody();
        respBody.setData(data);
        return respBody;
    }
    public static RespBody build(String code, String message){
        RespBody respBody = new RespBody();
        respBody.setMessage(message);
        respBody.setCode(code);
        return respBody;
    }
    public static RespBody build(String code, String message, Object data){
        RespBody respBody = new RespBody();
        respBody.setData(data);
        respBody.setCode(code);
        respBody.setMessage(message);
        return respBody;
    }
    public static RespBody build(String code, String message,String description, Object data){
        RespBody respBody = new RespBody();
        respBody.setData(data);
        respBody.setCode(code);
        respBody.setMessage(message);
        respBody.setDescription(description);
        return respBody;
    }
}
